package com.module.ble.yQi

import android.os.RemoteException
import android.util.Log
import com.eiot.ringsdk.ServiceSdkCommandV2
import com.eiot.ringsdk.battery.PowerState
import com.eiot.ringsdk.be.DeviceConfig
import com.eiot.ringsdk.callback.DeviceConfigCallback
import com.eiot.ringsdk.callback.DeviceSosCallback
import com.eiot.ringsdk.callback.PowerStateCallback
import com.eiot.ringsdk.ext.logIx
import com.eiot.ringsdk.sos.DeviceSos
import com.module.ble.hDu.HDuSendCommandManage
import com.module.ble.utils.AizoSDKUtil
import com.sxr.sdk.ble.keepfit.aidl.IRemoteService

/**
 *
 * 作者：sosou
 *
 * 版本：1.0
 *
 * 创建日期：2025/3/25
 *
 * 描述：研强命令发送管理
 *
 * 修订历史：
 *
 */
object YQiSendCommandManage {

    private const val TAG = "YQiSendCommandManage"


    /**
     * 读取手环电量
     */
    fun callRemoteGetDeviceBattery(mService: ServiceSdkCommandV2?): Boolean {
        Log.e(TAG, "Remote call callRemoteGetDeviceBattery!")
        mService?.getInstantPowerState()
        return true
    }

    fun registerOtherListener(mService: ServiceSdkCommandV2?){

        //Battery
        mService?.registerPowerStateListener(object : PowerStateCallback {
            override fun PowerState(bean: PowerState) {
//                bean.toString().logIx("电量信息")
                AizoSDKUtil.setElectricityInfo(bean.electricity, bean.workingMode)
            }
        })

        //SOS
//        mService?.getDeviceSos(object : DeviceSosCallback {
//            override fun deviceSos(bean: DeviceSos) {
////                mViewBind.sosSbv.setCheckedNoAction(bean.sosSwitch == 1)
//            }
//        })

        //DeviceConfig
        mService?.addDeviceConfigCallback(object : DeviceConfigCallback {
            override fun deviceConfig(bean: DeviceConfig) {
//                bean.isTouchSet.logIx("isTouchSet")

//                heartRateMonitoring//0x00:不支持 0x01:支持心率测量但不支持远程触发0x03:支持心率测量且支持APP远程触发检测
//                bloodOxygenMonitoring//0x00:不支持0x01:支持血氧测量但不支持远程触发0x03:支持血氧测量且支持APP远程触发检测
//                temperatureMonitoring//0x00:不支持0x01:支持体温测量但不支持远程触发0x03:支持体温测量且支持APP远程触发检测
//                sleepMonitoring//0x00:不支持0x01:支持睡眠监测但不支持远程触发0x03:支持睡眠监测且支持APP远程触发检测
//                pressureMonitoring //0x00:不支持0x01:支持压力测量但不支持远程触发0x03:支持压力测量且支持APP远程触发检测
//                bloodSugarMonitoring //0x00:不支持0x01:支持血糖测量但不支持远程触发0x03:支持血糖测量且支持APP远程触发检测
//                bloodPressureMonitoring//0x00:不支持0x01:支持血压测量但不支持远程触发0x03:支持血压测量且支持APP远程触发检测
//                ecgMonitoring//0x00:不支持0x01:支持心电测量但不支持远程触发0x03:支持心电测量且支持APP远程触发检测

                    ("bloodOxygenMonitoring:" + bean.bloodOxygenMonitoring + "\n"
                            + "bloodPressureMonitoring:" + bean.bloodPressureMonitoring + "\n"
                            + "bloodSugarMonitoring:" + bean.bloodSugarMonitoring + "\n"
                            + "breatheMonitoring:" + bean.breatheMonitoring + "\n"
                            + "ecgMonitoring:" + bean.ecgMonitoring + "\n"
                            + "heartRateMonitoring:" + bean.heartRateMonitoring + "\n"
                            + "isHeartRateSupport:" + bean.isHeartRateSupport + "\n"
                            + "isTouchSet" + bean.isTouchSet + "\n"
                            + "pressureMonitoring:" + bean.pressureMonitoring + "\n"
                            + "sleepMonitoring:" + bean.sleepMonitoring + "\n"
                            + "sosTriggerMode:" + bean.sosTriggerMode + "\n"
                            + "supportSos:" + bean.supportSos + "\n"
                            + "supportWakeupByGesture：" + bean.supportWakeupByGesture + "\n"
                            + "temperatureMonitoring:" + bean.temperatureMonitoring + "\n"
                            + "support vibrate:" + bean.vibrate
                            )
            }
        })
    }


    fun clearOtherListener(mService: ServiceSdkCommandV2?){

        //Battery
        mService?.clearPowerStateCallback()
        //DeviceConfig
        mService?.clearDeviceConfigCallback()
    }

}
